import { Route, Routes } from 'react-router-dom'
import KeepAlive from "react-activation"
import LoginPage from '@/page/LoginRegister/login'
import RegisterPage from '@/page/LoginRegister/register'
import HomePage from '@/page/Home'
import DetailPage from '@/page/Detail'
import CategoryPage from '@/page/Category'
import MiinePage from '@/page/Mine'
import CollectPage from '@/page/Mine/component/Collect'
import AddressPage from '@/page/Mine/component/Address'
import EditAddressPage from '@/page/Mine/component/EditAddress'
import ShopcartPage from '@/page/Shopcart'

function App() {
  return (
    <div className="App">
      <Routes>
        <Route path='/login' element={<LoginPage/>}></Route>
        <Route path='/register' element={<RegisterPage/>}></Route>
        <Route path='/home' element={<KeepAlive when={[true, true]} saveScrollPosition={'screen'} key='home'><HomePage/></KeepAlive>}></Route>
        <Route path='/detail' element={<KeepAlive when={[true, true]} saveScrollPosition={'screen'} key='detail'><DetailPage/></KeepAlive>}></Route>
        <Route path='/category' element={<KeepAlive when={[true, true]} saveScrollPosition={'screen'} key='category'><CategoryPage/></KeepAlive>}></Route>
        <Route path='/mine' element={<KeepAlive when={[true, true]} saveScrollPosition={'screen'} key='mine'><MiinePage/></KeepAlive>}></Route>
        <Route path='/collect' element={<KeepAlive when={[true, true]} saveScrollPosition={'screen'} key='collect'><CollectPage/></KeepAlive>}></Route>
        <Route path='/address' element={<AddressPage/>}></Route>
        <Route path='/editAddress' element={<EditAddressPage/>}></Route>
        <Route path='/shopcart' element={<KeepAlive when={[true, true]} saveScrollPosition={'screen'} key='shopcart'><ShopcartPage/></KeepAlive>}></Route>
      </Routes>
    </div>
  );
}

export default App;
